﻿using Basic.UserCollect;
using WeDonekRpc.Client.Interface;
using WeDonekRpc.Helper;

namespace Basic.UserLocalEvent.CancelBind
{
    internal class CancelBindHandler : IEventHandler<CancelUserBind>
    {
        private readonly IWxUserCollect _Service;

        public CancelBindHandler (IWxUserCollect service)
        {
            this._Service = service;
        }

        public void HandleEvent (CancelUserBind data, string eventName)
        {
            long[] ids = this._Service.FindId(data.UserId);
            if (ids.IsNull())
            {
                return;
            }
            this._Service.Cancel(ids);
        }
    }
}
